B1: Effects and Handlers with Koka or Flix

Seminar

Writing programs in a purely functional language comes with some advantages especially when we want to reason about the program. This is manly thanks to the fact that in purely functional languages functions are pure and therefore some function invocation `f x` always produces the same result because it is not able to alter any internal state.

Many programs, however, cannot be modelleded 100% as a completely determinstic mathematically pure function. For example, any program requiring IO (read and write to files, database, network communication), taking external actions such as (performing robotic actions, taking a camera picture), or getting truly random numbers. Other things that go beyond what pure functions can do, are nonterminating functions (the are the ability to have an infinite loop), or nondeterministic and probabilistic evaluation (to perform a coin flip, and return both results at the end of the function, exploring all combinatorial possibilities).

These things are called (side)-effects.

There have been different ways to handle effects

In this Seminar topic you will learn one of the two languages Koka or Flix and research on the advantages and disadvantages of those effect languages.

References